import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CollectVO, CollectForm, CollectQuery } from '@/api/business/collect/types';

/**
 * 查询用户收藏列表
 * @param query
 * @returns {*}
 */

export const listCollect = (query?: CollectQuery): AxiosPromise<CollectVO[]> => {
  return request({
    url: '/business/collect/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户收藏详细
 * @param businessCollectId
 */
export const getCollect = (businessCollectId: string | number): AxiosPromise<CollectVO> => {
  return request({
    url: '/business/collect/' + businessCollectId,
    method: 'get'
  });
};

/**
 * 新增用户收藏
 * @param data
 */
export const addCollect = (data: CollectForm) => {
  return request({
    url: '/business/collect',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户收藏
 * @param data
 */
export const updateCollect = (data: CollectForm) => {
  return request({
    url: '/business/collect',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户收藏
 * @param businessCollectId
 */
export const delCollect = (businessCollectId: string | number | Array<string | number>) => {
  return request({
    url: '/business/collect/' + businessCollectId,
    method: 'delete'
  });
};
